package kr.hkit.powerjava.algorithm;

import java.util.*;

public class Queue {
	private int size;
	private int top;	
	private String[] arrItem;

	
	public Queue(int size) {
		this.size = size;
		arrItem = new String[size];
		top = -1;
	}
	
	public void push(String item){
		if(!isFull()){
		arrItem[++top] = item; 
		}else{
		System.out.println("Queue Is Full");
		}
	}
	
	public String pop(){
		if(!isEmpty()){
			return arrItem[top--];
		}else{
			return "Queue is Empty";
		}
	}
	
	public boolean isFull(){
		return top == size-1;
	}
	public boolean isEmpty(){
		return top == -1;
	}
	public void prnStack() {
		for(int i=0; i<=top; i++){
			System.out.printf("[%s]\t", arrItem[i]);
			
		}
	}
	
	
	@Override
	public String toString() {
		return "Stack [size=" + size + ", top=" + top + ", arrItem="
				+ Arrays.toString(arrItem) + "]";
	}
}
}
